<?php
use yii\helpers\Html;
$post=\Yii::$app->session->getFlash('post');
?>
<?php $this->beginBlock('title'); ?>
    <?php if(isset($model['id'])):?>编辑<?php else:?>新增<?php endif;?>游戏公告
<?php $this->endBlock();?>
<?php $this->beginBlock('breadcrumb'); ?>
<li><a href="<?php echo \Yii::$app->urlManager->createUrl('/game-notice/index')?>">游戏公告</a></li>
<li class="active"><a href="<?php echo \Yii::$app->urlManager->createUrl('/game-notice/edit',['id'=>isset($model['id'])?$model['id']:0]);?>"><?php if(isset($model['id'])):?>编辑<?php else:?>新增<?php endif;?>游戏公告</a></li>
<?php $this->endBlock();?>

<link rel="stylesheet" type="text/css" href="<?php echo Yii::$app->request->baseUrl; ?>/js/bootstrap-datetimepicker/css/datetimepicker.css"/>
<div class="row">
	<div class="col-sm-12">
		<section class="panel">
			<div class="panel-body">
				<div class="form">
					<form class="cmxform form-horizontal tasi-form" method="post" action="<?php echo \Yii::$app->urlManager->createUrl('/game-notice/save');?>">
						<div class="form-group">
							<label for="game_name" class="control-label col-lg-2">所属游戏</label>
							<div class="col-lg-10">
                               	<input class="form-control" id="game_name" name="game_name" value="<?=Html::encode($model['game_name']?:'尚未指派');?>" type="text" disabled="" />
                            </div>
						</div>
                        <div class="form-group">
                            <label for="title" class="control-label col-lg-2">标题</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="title" type="text" value="<?php if(isset($post['title'])){ echo $post['title'];}else{ echo Html::encode($model['title']?:''); }?>" name="title" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="url" class="control-label col-lg-2">链接URL</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="url" type="text" value="<?php if(isset($post['url'])){ echo $post['url'];}else{ echo Html::encode($model['url']?:''); }?>" name="url" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="starttime" class="control-label col-lg-2">开始时间</label>
                            <div class="col-lg-10">
                                <input class="form-control form_datetime" size="16" id="starttime" type="text" name="starttime" value="<?php if(isset($post['starttime'])){ echo $post['starttime'];}else{ echo date('Y-m-d H:m', $model['starttime']); }?>" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="endtime" class="control-label col-lg-2">结束时间</label>
                            <div class="col-lg-10">
                                <input class="form-control form_datetime" size="16" id="endtime" type="text" name="endtime" value="<?php if(isset($post['endtime'])){ echo $post['endtime'];}else{ echo date('Y-m-d H:m', $model['endtime']); }?>" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="orderno" class="control-label col-lg-2">排序值</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="orderno" type="text" value="<?php if(isset($post['orderno'])){ echo $post['orderno'];}else{ echo Html::encode(isset($model['orderno'])?$model['orderno']:100); }?>" name="orderno" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="showchannel" class="control-label col-lg-2">显示设备</label>
                            <div class="col-lg-10">
                                <div class="radio-custom radio-success">
		                            <input type="radio" value="0" <?php if(isset($post['showchannel']) && $post['showchannel']==0):?>checked<?php elseif(isset($model['showchannel']) && $model['showchannel']==0):?>checked<?php endif;?> name="showchannel" id="showchannelall">
		                            <label for="showchannelall">全部显示</label>
		                            <input type="radio" value="1" <?php if(isset($post['showchannel']) && $post['showchannel']==1):?>checked<?php elseif(isset($model['showchannel']) && $model['showchannel']==1):?>checked<?php endif;?> name="showchannel" id="showchannelandroid">
		                            <label for="showchannelandroid">安卓</label>
		                            <input type="radio" value="2" <?php if(isset($post['showchannel']) && $post['showchannel']==2):?>checked<?php elseif(isset($model['showchannel']) && $model['showchannel']==2):?>checked<?php endif;?> name="showchannel" id="showchannelios">
		                            <label for="showchannelios">IOS</label>
		                        </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="gametype" class="control-label col-lg-2">类型</label>
                            <div class="col-lg-10">
                                <div class="radio-custom radio-success">
		                            <input type="radio" value="0" <?php if(isset($post['gametype']) && $post['gametype']==0):?>checked<?php elseif(isset($model['gametype']) && $model['gametype']==0):?>checked<?php endif;?> name="gametype" id="gametypeall">
		                            <label for="gametypeall">不关联游戏</label>
		                            <input type="radio" value="1" <?php if(isset($post['gametype']) && $post['gametype']==1):?>checked<?php elseif(isset($model['gametype']) && $model['gametype']==1):?>checked<?php endif;?> name="gametype" id="gametypedanji">
		                            <label for="gametypedanji">单机</label>
		                            <input type="radio" value="2" <?php if(isset($post['gametype']) && $post['gametype']==2):?>checked<?php elseif(isset($model['gametype']) && $model['gametype']==2):?>checked<?php endif;?> name="gametype" id="gametypewangyou">
		                            <label for="gametypewangyou">网游</label>
		                        </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-10">
                                <input type="hidden" name="_csrf" id="_csrf" value="<?=\Yii::$app->request->csrfToken; ?>" />
        						<?php if(isset($model['id'])):?><input type="hidden" name="id" value="<?=$model['id'];?>" /><?php endif;?>
                                <button class="btn btn-success" type="submit"> 保存</button>
                                <button class="btn btn-default" type="button" onclick="javascript:history.go(-1)"> 取消</button>
                            </div>
                        </div>
                    </form>
                </div>
			</div>
		</section>
	</div>
</div>

<?php
$this->beginBlock('script');
?>
<script type="text/javascript" src="<?php echo Yii::$app->request->baseUrl; ?>/js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="<?php echo Yii::$app->request->baseUrl; ?>/js/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript">
//时间选择
$('.form_datetime').datetimepicker({
    format: 'yyyy-mm-dd hh:ii',
    autoclose:true,
    language: "zh-CN",
})
</script>
<?php $this->endBlock('script');?>